import sys
import urllib
from datetime import datetime
import time

url = 'http://eventos.livepass.com.ar/eventperformances.asp?evt=44'

def main(*args):
	first = True
	
	while True:
		try:
			#download html
			html = str(urllib.urlopen(url).read())

			#test
			if html.find('congestionada') == -1:
				for i in range(10):
					print('\a')
					time.sleep(.5)

				print(datetime.now().isoformat(), ': no esta caido')
				print(html)
			else:
				print(datetime.now().isoformat(), ': esta caido')

		except:
			print(datetime.now().isoformat(), ': error')		
		
		time.sleep(5)

if __name__ == '__main__':
    sys.exit(main(*sys.argv))
